package com.ruoyi.hqfinance.service.impl;

import com.github.pagehelper.PageHelper;
import com.ruoyi.hqfinance.domain.HqNewDepartureOperateFeeSheet;
import com.ruoyi.hqfinance.domain.vo.HqNewDepartureOperateFeeSheetVo;
import com.ruoyi.hqfinance.mapper.HqNewDepartureOperateFeeSheetMapper;
import com.ruoyi.hqfinance.service.HqNewDepartureOperateFeeSheetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HqNewDepartureOperateFeeSheetServiceImpl implements HqNewDepartureOperateFeeSheetService {
    @Autowired
    private HqNewDepartureOperateFeeSheetMapper hqNewDepartureOperateFeeSheetMapper;
    @Override
    public List<HqNewDepartureOperateFeeSheet> collect(HqNewDepartureOperateFeeSheetVo vo) {
        PageHelper.startPage(vo.getPageDate());
        List<HqNewDepartureOperateFeeSheet> sheets = hqNewDepartureOperateFeeSheetMapper.collect(vo);
        assert sheets != null;
        for (HqNewDepartureOperateFeeSheet hqNewDepartureOperateFeeSheet : sheets){
            if (vo.getDateType() == 2){
                hqNewDepartureOperateFeeSheet.setCollectDate(vo.getStartTime() + "至" + vo.getEndTime());
            }
            hqNewDepartureOperateFeeSheet.setPolicyArea("经直属中心");
        }
        return sheets;
    }
}
